﻿<phone:PhoneApplicationPage 
	x:Class="GeolocationSample.MainPage"
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
	xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
	xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
	xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
	mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="768"
	FontFamily="{StaticResource PhoneFontFamilyNormal}"
	FontSize="{StaticResource PhoneFontSizeNormal}"
	Foreground="{StaticResource PhoneForegroundBrush}"
	SupportedOrientations="Portrait" Orientation="Portrait"
	shell:SystemTray.IsVisible="True">
	
	<shell:SystemTray.ProgressIndicator>
		<shell:ProgressIndicator x:Name="indicator" IsVisible="{Binding ShowProgress}"  IsIndeterminate="true" />
	</shell:SystemTray.ProgressIndicator>

	<!--LayoutRoot is the root grid where all page content is placed-->
	<Grid x:Name="LayoutRoot" Background="Transparent">
		<Grid.RowDefinitions>
			<RowDefinition Height="Auto"/>
			<RowDefinition Height="*"/>
		</Grid.RowDefinitions>

		<!--TitlePanel contains the name of the application and page title-->
		<StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28">
			<TextBlock x:Name="ApplicationTitle" Text="Xamarin Mobile API Preview Geolocation Sample" Style="{StaticResource PhoneTextNormalStyle}"/>
			<TextBlock x:Name="PageTitle" Text="geolocation" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
		</StackPanel>

		<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
			<Grid.ColumnDefinitions>
				<ColumnDefinition Width="40*" />
				<ColumnDefinition Width="60*" />
			</Grid.ColumnDefinitions>
			<Grid.RowDefinitions>
				<RowDefinition Height="80" />
				<RowDefinition Height="40" />
				<RowDefinition Height="40" />
				<RowDefinition Height="40" />
				<RowDefinition Height="40" />
				<RowDefinition Height="40" />
				<RowDefinition Height="40" />
				<RowDefinition Height="40" />
				<RowDefinition Height="40" />
				<RowDefinition Height="40" />
			</Grid.RowDefinitions>
			
			<StackPanel Grid.Row="0" Grid.ColumnSpan="2" Orientation="Horizontal" HorizontalAlignment="Center">
				<Button Command="{Binding GetPosition}">Get Location</Button>
				<Button Command="{Binding ToggleListening}">Toggle Listening</Button>
			</StackPanel>

			<TextBlock Grid.Row="1" Grid.Column="0">Status:</TextBlock>
			<TextBlock Grid.Row="1" Grid.Column="1" Text="{Binding Status}" />

			<TextBlock Grid.Row="2" Grid.Column="0">Time:</TextBlock>
			<TextBlock Grid.Row="2" Grid.Column="1" Text="{Binding CurrentPosition.Timestamp}" />

			<TextBlock Grid.Row="3" Grid.Column="0">Latitude:</TextBlock>
			<TextBlock Grid.Row="3" Grid.Column="1" Text="{Binding CurrentPosition.Latitude}" />

			<TextBlock Grid.Row="4" Grid.Column="0">Longitude:</TextBlock>
			<TextBlock Grid.Row="4" Grid.Column="1" Text="{Binding CurrentPosition.Longitude}" />

			<TextBlock Grid.Row="5" Grid.Column="0">Accuracy:</TextBlock>
			<TextBlock Grid.Row="5" Grid.Column="1" Text="{Binding CurrentPosition.Accuracy}" />

			<TextBlock Grid.Row="6" Grid.Column="0">Heading:</TextBlock>
			<TextBlock Grid.Row="6" Grid.Column="1" Text="{Binding CurrentPosition.Heading}" />
			
			<TextBlock Grid.Row="7" Grid.Column="0">Altitude:</TextBlock>
			<TextBlock Grid.Row="7" Grid.Column="1" Text="{Binding CurrentPosition.Altitude}" />

			<TextBlock Grid.Row="8" Grid.Column="0">Altitude Accuracy:</TextBlock>
			<TextBlock Grid.Row="8" Grid.Column="1" Text="{Binding CurrentPosition.AltitudeAccuracy}" />

			<TextBlock Grid.Row="9" Grid.Column="0">Speed:</TextBlock>
			<TextBlock Grid.Row="9" Grid.Column="1" Text="{Binding CurrentPosition.Speed}" />
		</Grid>
	</Grid>
</phone:PhoneApplicationPage>